﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content4" ContentPlaceHolderID="CurrentMenuIDContent" runat="server">
    profileMenu</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    My Email Notification
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" type="text/css" href="<%= Url.Content("~/Content/jquery-ui-1.8.16.custom.css") %>" />
    <script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-ui-1.8.16.custom.min.js") %>"></script>
    <script type="text/javascript" src="../../Scripts/site.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <tr>
            <td width="300px">
                <h2>
                    My Email Notification</h2>
            </td>
            <td>
                <form action='<%= Url.Content("~/EmailNotification/Create") %>'>
                <input type="submit" class="button left" value="     Create     " />
                </form>
            </td>
        </tr>
    </table>
    <br />
    <% Using Html.BeginForm()%>
    <%= Html.ValidationSummary(False) %>
    <fieldset>
        <legend>Email Notification Preferences</legend>
        <table>
            <tr>
                <td id="notifListContent" colspan="2">
                    <% Html.RenderPartial("~/Views/EmailNotification/Controls/NotificationGrid.ascx")%>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" name="SavePreference" class="button right" value="   Save   " />
                </td>
            </tr>
        </table>
    </fieldset>
    <% End Using%>
    <script type="text/javascript">
        $(document).ready(function () {
            $("input[name^=cbxSendImmediately_]").change(function () {
                var bSelected = $(this).is(':checked');
                if (bSelected === true) {
                    var id = $(this).attr("id").split("_")[1];
                    $('input[name=cbxSendOnSelectedDays_' + id + ']').attr('checked', !bSelected);
                }
            });

            $("input[name^=cbxSendOnSelectedDays_]").change(function () {
                var bSelected = $(this).is(':checked');
                if (bSelected === true) {
                    var id = $(this).attr("id").split("_")[1];
                    $('input[name=cbxSendImmediately_' + id + ']').attr('checked', !bSelected);
                }
            });
        });


        function deleteWithEffect(id) {
            if (confirm("Do you really want to delete this Email Notification?")) {
                jQuery.ajax({
                    type: 'POST',
                    data: { id: id },
                    url: '<%: Url.Action("DeleteNotification") %>',
                    dataType: "json",
                    success: function (result) {
                        if (result.Result === "ok") {
                            $("#notRow_" + id + " td").effect("highlight",
                        { mode: "hide", color: "#ff4444" },
                        1000,
                        function () {
                            $(this).remove();
                        });
                        }
                        else {
                            alert(result.Message);
                        }
                    }
                });
            }
        }

    </script>
</asp:Content>
